<?
namespace app\admin\validate;

use think\Validate;

class Node extends Validate
{
    protected $rule =   [
		'id'		=>	'require|number',
        'node_name'  => 'require|max:15',
        'module_name'   => 'require|min:3',
		'control_name'=>'require',
		'action_name'=>'require',
		'is_menu'	=>'number|between:0,1'
    ];
    
    protected $message  =   [
		'id.require'		=> 'ID必须',
		'id.number'			=>	'ID无效',
        'node_name.require' => '名称必须',
        'node_name.max'     => '名称最多不能超过15个字符',
		'module_name.require' => '根节点必须',
        'module_name.min'     => '根节点不能少于3个字符',
		'control_name.require' => '控制器必须',
		'action_name.require'	=>	'操作必须',
    ];
    protected $scene = [
		'add'  =>  ['node_name','module_name','control_name','action_name'],
		'edit'  => ['id','node_name','module_name','control_name','action_name'],
		'del'	=>	['id']
    ];
}